{% extends 'book/layout.html' %} {% block body %}
<div class="example">
    <form>
        <div class="input-control text full-size" data-role="input">
            <input type="text" name="q" placeholder="输入关键字搜索" value="{{ q }}" />
            <button class="button"><span class="mif-search"></span></button>
        </div>
    </form>
    {% load static %}
    <ul class="listview image media-list">
    {% for book in books %}
    <li class="media">
        <div class="icon media-left">
            <a href="{% url 'book:item' book.slug %}">
                {% include 'book/_cover.html' %}         
            </a>
        </div>
        <div class="data media-body">
            <h4 class="media-heading"><a style="color:#000;" href="{% url 'book:item' book.slug %}">{{ book.title }}</a></h4>
            By: {% for ba in book.authors.all %}
            <a class="author-name" href="{% url 'book:author' ba.slug %}" data-href="{{ba.slug}}">{{ ba.name }}</a>
            {% endfor %}
            {% if book.summary %}
                {{ book.summary|safe|truncatechars_html:200 }}
            {% else %}
                <p>无</p>
            {% endif %}


            {% for ba in book.tags.all %}
            <a  data-href="{{ba.slug}}" data-id="{{ ba.id}}">{{ ba.name }}</a>
            {% endfor %}
        </div>
    </li>
    {% empty  %}
    <li>找不到^_^</li>
    {% endfor %}
</ul>
<div class="pagination">
    {% load url_replace %}
    <ul class="text-center">
        {% if books.has_previous %}
        <li class="prev">
            <a href="?{% url_replace page=books.previous_page_number %}"></a>
        </li>
        {% endif %}
       
        <li class="active"><a>{{ books.number }}</a></li>            
       
        {% if books.has_next %}
        <li class="next">
            <a href="?{% url_replace page=books.next_page_number %}"></a>
        </li>
        {% endif %}
    </ul>
</div>
</div>
{% endblock %}